<?php

namespace app\admin\model\validate;

use think\Validate;

class Article extends Validate {
    protected $rule =   [
        'token'  => 'require|max:60|unique:article',
        'cate_id' => 'number|require',
        'cate_name' => 'require|max:24',
        'title' => 'require|max:255',
        'cover_img_url' => 'max:255',
        'button_key' => 'max:20',
        'button_name' => 'max:24',
        'mp3_url' => 'require|max:255',
        'lyric' => 'max:255',
        'share_title' => 'max:20',
        'share_img_url' => 'max:255',
        'from_url' => 'max:255',
        //'video_url' => 'max:255',
        //'content' => 'require',
        //'status' => 'number',
        //'type' => 'number',
    ];

    protected $message  =   [
        'token.require' => '主题token不能为空',
        'token.unique' => '主题token已经存在',
        'token.max' => '主题token不能超过60个字符',
        'cate_name.require'     => '美文分类不能为空',
        'cate_id.require'     => '美文分类不能为空',
        'cate_name.max'     => '美文分类最多不能超过24个字符',
        'title.require'     => '标题不能为空',
        'title.max'     => '标题不能超过255个字符',
        //'cover_img_url.require'     => '封面图片不能为空',
        'cover_img_url.max'     => '封面图片不能超过255个字符',
        'button_key.max'     => '跳转键名不能超过20个字符',
        'button_name.max'     => '跳转按钮名不能超过24个字符',
        'mp3_url.require'     => '背景音乐不能为空',
        'mp3_url.max'     => '背景音乐不能超过255个字符',
        'lyric.max'     => '歌词不能超过255个字符',
        'share_title.max'     => '分享标题不能超过20个字符',
        'share_img_url.max'     => '分享封面不能超过255个字符',
        //'from_url.require'     => '采集来源不能为空',
        'from_url.max'     => '采集来源不能超过255个字符',
        //'video_url.max'     => '视频地址不能超过255个字符',
    ];

    protected $scene = [
        /*'add'  =>  ['name','theme','start_time', 'end_time', 'attention_tips', 'cover_image_url', 'sort', 'participate_num'],*/
        'edit'  =>  ['cate_name','title', 'cover_img_url', 'button_key', 'button_name', 'mp3_url', 'lyric', 'share_title', 'share_img_url', 'from_url'],
    ];
}